<div class="fixed-bar">
    <form class="layui-form layui-form-pane fixed-bar-form" action="{:url()}" method="get" id="hisi-table-search">
        <div class="layui-form-item">
        	
	        <div class="layui-inline">
	        	<label class="layui-form-label">材料名称</label>
	            <div class="layui-input-inline">
	                <input type="text" name="material_name" lay-verify="" placeholder="输入材料名称" class="layui-input">
	            </div>
	        </div>
	        
	        <div class="layui-inline">
	        	<label class="layui-form-label">物料SKU</label>
	            <div class="layui-input-inline">
	                <input type="text" name="material_sku" lay-verify="" placeholder="输入材料SKU" class="layui-input">
	            </div>
	        </div>
	        
	        <div class="layui-inline">
	        	<button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">搜索</button>
	        </div>
        </div>
    </form>
</div>

<table id="dataTable"></table>

{include file="system@block/layui" /}

<script type="text/html" title="操作按钮模板" id="buttonTpl">
    <a href="{:url('log')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-warm hisi-iframe" hisi-data="{width: '850px', height: '600px'}" title="查看操作日志">操作日志</a>
</script>

<script type="text/html" id="toolbar">
    <div class="layui-btn-group fl">
        <a href="{:url('add', ['_t' => 3])}" class="layui-btn layui-btn-primary layui-btn-sm layui-icon layui-icon-add-circle-fine hisi-iframe" hisi-data="{width: '500px', height: '500px'}" title="新物料入库">&nbsp;新物料入库</a>
    </div>
</script>

<script type="text/html" id="updateTimeTpl">
    <div>{{layui.util.toDateString(d.update_time * 1000) }}</div>
</script>

<script type="text/javascript">
    layui.use(['table', 'tool'], function() {
        var table = layui.table;
        table.render({
            elem: '#dataTable'
            ,url: '{:url()}' //数据接口
            ,page: true //开启分页
            ,skin: 'row'
            ,even: true
            ,limit: 20
            ,limits: [20,50,100,150,200]
            ,text: {
                none : '暂无相关数据'
            }
            ,toolbar: '#toolbar'
            ,defaultToolbar: ['filter', 'exports', 'print']
            ,cols: [[ //表头
                {type:'checkbox', fixed:'left'}
                ,{field: 'id', title: '编号', sort: true}
                ,{field: 'name', title: '物料名称',templet:function(d){return '<span class="copy-item">'+d.mInfo.name+'</span>'}, width:200}
                ,{field: 'material_sku', title: '物料SKU',templet:function(d){return '<span class="copy-item">'+d.mInfo.material_sku+'</span>'}, width:200}
                ,{field: 'stockStorehouseName', title: '货仓'}
                ,{field: 'stockStoreshelfName', title: '货架'}
                ,{field: 'stock', title: '库存量'}
                ,{field: 'stock_unit_price', title: '库存单价'}
                ,{field: 'stock_amount', title: '库存价值'}
                ,{field: 'update_time', title: '更新时间',templet: '#updateTimeTpl', width:150}
                ,{title: '操作', templet: '#buttonTpl', fixed: 'right',width:150}
            ]]
        });
    });
</script>